class Solution:
	def lengthOfLongestSubstring(self, s: str) -> int:
		max_len = 0
		char_dict = {}
		index = 0
		while s[index:].__len__() >= max_len:
			current_len = 0
			for item in s[index:]:
				old_index = char_dict.get(item)
				if old_index is not None:
					index = old_index + 1
					char_dict.clear()
					break
				char_dict[item] = index
				index += 1
				current_len += 1
			if current_len > max_len:
				max_len = current_len
		return max_len
